<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品标签</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script src="../script/my_lightbox.js" language="javascript"></script>
</head>
<body>
	<div class="container">
        <div class="flow">
            <div class="itemtitle">
                <h3>产品标签</h3>
                <ul>
                    <li <{if $smarty.get.operation==''}>class="current"<{/if}>><a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>"><span>管理</span></a></li>
                   	<li <{if $smarty.get.operation=='add'}>class="current"<{/if}>><a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=add"><span>添加</span></a></li>
                    <{if $smarty.get.operation=='edit'}>
                    <li class="current"><a href="#"><span>修改</span></a></li>
                    <{/if}>
                </ul>
            </div>
        </div>
        <div class="h35"></div>
        <form action="" method="post">
        <{if $smarty.get.operation=='add' or $smarty.get.operation=='edit' }>
            <form name="form" id="form" method="post">
            <input name="id" type="hidden" id="id" value="<{$re.id}>">
            <table class="table">
                <thead>
                    <tr>
                        <th class="partition" colspan="99">产品标签</th>
                        <th class="partition"><a href="?m=product&s=product_tags_floor.php&act=keywords&editid=<{$re.id}>">设置关键字</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="?m=product&s=product_tags_floor.php&act=recpro&editid=<{$re.id}>&tag_name=<{$re.tags}>">设置推荐商品</a></th>
                    </tr>
                </thead>
                <tbody>
                
                <tr>
                    <td width="100">标签</td>
                    <td>
                    <select class="ws350" name='pid' >
                    	<option value='0'>顶级类别</option>
                        <{foreach item=list from=$de}>
                        
             			<option <{if $re.cid==$list.id || $smarty.get.id==$list.id}> selected="selected" <{/if}> value="<{$list.id}>"><{$list.tags}></option>
                           
                            <{foreach item=slist from=$list.stags}>
                            <option <{if $re.cid==$slist.id || $smarty.get.id==$slist.id}> selected="selected" <{/if}> value="<{$slist.id}>">|__<{$slist.tags}></option>
                            	    
                                    <{foreach item=lists from=$slist.stags}>
                                    <option <{if $re.cid==$lists.id || $smarty.get.id==$lists.id}> selected="selected" <{/if}> value="<{$lists.id}>">|____<{$lists.tags}></option>
                            		<{/foreach}> 
                                    
                            <{/foreach}> 
                            
                        <{/foreach}> 
            		</select>
                    <div id="form-error" class="form-error"></div>
                    </td>
                </tr>
               
                <tr>
                    <td>标签名</td>
                    <td>
                    <{if $smarty.get.operation=='edit'}>
                    <input name="tags" type="text" id="tags" class="w350" value="<{$re.tags}>"/>
                    <{else}>
                    <textarea name="tags" id="tags" class="w350" rows="10"></textarea>
                    <div>可批量添加，每行一个标签</div>
                    <{/if}>
                    <div id="form-error" class="form-error"></div>
                    </td>
                </tr>             
                
                
                <tr>
                    <td>LOGO(小)</td>
                    <td>
                    <input name="logo" class="w350" type="text" id="pic" value="<{$re.logo}>" />
                    <input name="oldlogo" type="hidden" value="<{$re.logo}>" />
                    [<a href="javascript:uploadfile('上传LOGO','pic',42,42,'tags')">上传</a>] 
                    [<a href="javascript:preview('pic');">预览</a>]
                    [<a onclick="javascript:$('#pic').val('');" href="#">删除</a>] <span class="bz"></span>
                    </td>
                </tr>
                <tr>
                    <td>LOGO(大)</td>
                    <td>
                    <input name="logo_large" class="w350" type="text" id="pic_large" value="<{$re.logo_large}>" />
                    <input name="oldlogolarge" type="hidden" value="<{$re.logo_large}>" />
                    [<a href="javascript:uploadfile('上传LOGO','pic_large',0,0,'tags')">上传</a>] 
                    [<a href="javascript:preview('pic_large');">预览</a>]
                    [<a onclick="javascript:$('#pic_large').val('');" href="#">删除</a>] <span class="bz"></span>
                    </td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td>
                    <input type="radio" name="status" value="1" id="open" <{if $re.status==1}>checked="checked"<{/if}>/><label for="open">开启</label>
                    <input type="radio" name="status" value="0" id="close" <{if $re.status==0}>checked="checked"<{/if}>/><label for="close">关闭</label>
                    </td>
                </tr>
                     
                <tr>
                    <td>&nbsp;</td>
                    <td>
                    <input class="submit" type="submit" value="提交">
                    <input name="act" type="hidden" id="action" value="<{if !$smarty.get.editid}>save<{else}>edit<{/if}>">
                   
                    </td>
                </tr>
                </tbody>
            </table>
            </form>
        <{else}>
        <table class="table">
        	
            <tbody>
                <tr class="header partition">
                    <th width="30"></th>
                    <th width="70">显示顺序</th>
                    <th>标签名称</th>
                    <th>状态</th>
                    <th width="70"></th>
                </tr>
            </tbody>  
              
            <{foreach item=list key=key from=$de}>
            <tbody>
                <tr>
                	<{if $list.stags}>
                	<td onclick="toggle_group('group_<{$list.id}>')">
                    <a id="a_group_<{$list.id}>" href="javascript:void(0)"><{if $key>0}>[+]<{else}>[-]<{/if}></a>
                    </td>
                    <{else}><td></td><{/if}>
                    <td><input type="text" class="w50" maxlength="3" name="displayorder[<{$list.id}>]" value="<{$list.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td>
                        <input type="text" class="w150" name="name[<{$list.id}>]" value="<{$list.tags}>" />
                        <a class="addchildboard" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=add&id=<{$list.id}>">添加子标签</a>
                    </td>
                    <td><{if $list.status==1}>开启<{elseif $list.status==0}>关闭<{/if}></td>
                    <td>
					<a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=edit&editid=<{$list.id}>"><{$editimg}></a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&delid=<{$list.id}>"><{$delimg}></a>
                  
                   </td>
                </tr>
            </tbody>
            
            <{if $list.stags}>
            <tbody id="group_<{$list.id}>" <{if $key>0}>style="display:none;"<{/if}>>
            <{foreach item=slist from=$list.stags}>
                <tr>
                	<td></td>
                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<{$slist.id}>]" value="<{$slist.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><div class="board"><input type="text" class="w150" name="name[<{$slist.id}>]" value="<{$slist.tags}>" /><a class="addchildboard" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=add&id=<{$slist.id}>">添加子标签</a></div></td>
                    <td><{if $slist.status==1}>开启<{elseif $slist.status==0}>关闭<{/if}></td>
                    <td>
					<a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=edit&editid=<{$slist.id}>"><{$editimg}></a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&delid=<{$slist.id}>"><{$delimg}></a>
                   </td>
                </tr>
            
			<{foreach item=clist from=$slist.stags}>
				<tr>
                	<td></td>
                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<{$clist.id}>]" value="<{$clist.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><div class="childboard"><input type="text" class="w150" name="name[<{$clist.id}>]" value="<{$clist.tags}>" /><a class="addchildboard" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=add&id=<{$clist.id}>">添加子标签</a></div></td>
                    <td><{if $clist.status==1}>开启<{elseif $clist.status==0}>关闭<{/if}></td>
                    <td>
					<a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=edit&editid=<{$clist.id}>"><{$editimg}></a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&delid=<{$clist.id}>"><{$delimg}></a>
                   </td>
                </tr>
             <{foreach item=lists from=$clist.stags}>
				<tr>
                	<td></td>
                	<td><input type="text" class="w50" maxlength="3" name="displayorder[<{$lists.id}>]" value="<{$lists.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                    <td><div class="childsboard"><input type="text" class="w150" name="name[<{$lists.id}>]" value="<{$lists.tags}>" /></div></td>
                    <td><{if $lists.status==1}>开启<{elseif $lists.status==0}>关闭<{/if}></td>
                    <td>
					<a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&operation=edit&editid=<{$lists.id}>"><{$editimg}></a>
                    <a onclick="return confirm('确定删除吗');" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&delid=<{$lists.id}>"><{$delimg}></a>
                   </td>
                </tr>
            <{foreachelse}>
            <{/foreach}>   
            <{foreachelse}>
            <{/foreach}>
            <{foreachelse}>
            <{/foreach}>
            </tbody>
            <{/if}>
            <{foreachelse}>
            <tr>
                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
            </tr>
            <{/foreach}>
            <tfoot>
                <tr>
                	<td colspan="2">
                        <input type="hidden" name="act" value="op" />
                        <input type="submit" name="submit" value="<{$lang.btn_submit}>" />
                    </td>
                    <td colspan="99"><div class="page"><{$de.page}></div></td>
                </tr>
            </tfoot>
        </table>
        </form>
        <{/if}>
    </div>
</body>
<script>
function toggle_group(oid, conf) {
	obj = $('#a_'+oid)[0];
	if(!conf) {
		var conf = {'show':'[-]','hide':'[+]'};
	}
	var obody = $('#'+oid)[0];
	if(obody.style.display == 'none') {
		obody.style.display = '';
		obj.innerHTML = conf.show;
	} else {
		obody.style.display = 'none';
		obj.innerHTML = conf.hide;
	}
}
</script>
</html>